<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        canvas{
            border: 1px solid red;
        }
    </style>
</head>
<body>
<canvas id="box" width="800" height="800"></canvas>
<script type="text/javascript">
    var box=document.getElementById("box");
    var pen=box.getContext("2d");
    pen.clearRect(0,0,box.width,box.height);//清除画布
    pen.translate(400,400);
    pen.rect(0,0,200,300);
    pen.rotate(Math.PI/180*360);
    pen.rect(0,0,200,300);
    pen.stroke();



</script>
</body>
</html>